﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MM.DBUtility;

namespace MM.DAL
{
    public class RuleInfo
    {
        public static bool ExistRules(string PID, string APPID)
        {
            string strSQL = string.Format("SELECT COUNT(1) FROM T_Rule WHERE PID='{0}' AND APPID='{1}' ", PID, APPID);
            return DbHelperSql.Exists(strSQL, null);
        }
        public static bool ExistRules(string PID, string APPID, string TaskType)
        {
            string strSQL = string.Format("SELECT COUNT(1) FROM T_Rule WHERE PID='{0}' AND APPID='{1}' AND TaskType={2}", PID, APPID, TaskType);
            return DbHelperSql.Exists(strSQL, null);
        }
        public static bool ExistTimer(string PID, string APPID)
        {
            string strSQL = string.Format("SELECT COUNT(1) FROM T_Timers WHERE PID='{0}' AND APPID='{1}'", PID, APPID);
            return DbHelperSql.Exists(strSQL, null);
        }
        public static bool ExistPID(string PID)
        {
            string strSQL = string.Format("SELECT COUNT(1) FROM T_Pinfo WHERE PID='{0}'", PID);
            return DbHelperSql.Exists(strSQL, null);
        }
        public static bool ExistAPPID(string APPID)
        {
            string strSQL = string.Format("SELECT COUNT(1) FROM T_APPinfo WHERE APPID='{0}'", APPID);
            return DbHelperSql.Exists(strSQL, null);
        }
    }
}
